package com.youxin.busfoundation.bean.login;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.youxin.busfoundation.bean.BaseRequestBean;
import com.youxin.busfoundation.common.login.TokenState;
import com.youxin.busfoundation.enums.LoginDeviceType;
import com.youxin.busfoundation.enums.LoginType;
import com.youxin.busfoundation.enums.SystemType;

/**
 * PayloadBean jwt 登录认证
 * @author yingde.cao
 */
public class PayloadBean extends BaseRequestBean{
	/**
	 * 产品id
	 */
	private int appid=SystemType.CP.getValue();
	/**
	 * 设备
	 */
	private int device=LoginDeviceType.PC.getValue();
	/**
	 * 默认手机号码+验证码登录
	 */
	private int logintype=LoginType.MobileCode.getValue();
	
	private long userid;	
	
	public long getUserid() {
		return userid;
	}

	public void setUserid(long userid) {
		this.userid = userid;
	}

	public int getLogintype() {
		return logintype;
	}

	public void setLogintype(int logintype) {
		this.logintype = logintype;
	}

	/**
	 * 创建时间
	 */
	private long createTime;

	public long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}
	/**
	 * 超时时间
	 */
	private long expires;
	
	
	public int getDevice() {
		return device;
	}

	public void setDevice(int device) {
		this.device = device;
	}

	public long getExpires() {
		return expires;
	}
	
	public void setExpires(long expires) {
		this.expires = expires;
	}

	public int getAppid() {
		return appid;
	}

	public void setAppid(int appid) {
		this.appid = appid;
	}
	
	@JsonIgnore
	private TokenState tokenState=TokenState.VALID;

	public TokenState getTokenState() {
		return tokenState;
	}

	public void setTokenState(TokenState tokenState) {
		this.tokenState = tokenState;
	}
	
	@JsonIgnore
	public boolean hasExpires()
	{
		return tokenState==TokenState.EXPIRED;
	}
	
}
